#include <stdio.h>

int fun(long m) {
	int a = 0, b = 0, c = 0, i;
	long int t;
	while (m > 0) {
		t = m % 10;
		if (t % 2 == 0)
			a++;
		else
			b++;
		m = m / 10;
	}
	c = a + b;
	if (a != 0)
		m = a * 100 + b * 10 + c;
	else
		m = b * 100 + a * 10 + c;
	return (m);
}

void main() {
	long int n;
	scanf("%ld", &n);
	printf("%ld\t", n);
	while (n != 123) {
		n = fun(n);
		printf("%ld\t", n);
	}
}
